##### To reproduce everything in the paper, run this whole file from within the 'reproduction' R project.
## This file runs the reproduction files from the three studies. All the tables and plots will appear in the empty folders.

## It is also possible to run each of the individual files for the three studies in the paper. 



# List of required packages
required_packages <- c("extrafont", "tidyverse", "estimatr", "margins", "viridis", "cregg",
                       "ggpubr", "cowplot", "mediation", "texreg", "haven", "gghighlight", 
                       "ggrepel", "interflex", "gridExtra", "foreign", "ggridges", "gdata")

# Function to install packages if not already installed
install_if_missing <- function(package_name) {
  if (!require(package_name, character.only = TRUE)) {
    install.packages(package_name, dependencies = TRUE)
  }
}

# Loop through the list of required packages and install them if needed
for (package_name in required_packages) {
  install_if_missing(package_name)
}





# Study 1
source("std1_07_analysis.R")






# Study 2
source("std2_02_analysis.R")






# Study 3
source("std3_01_clean_analysis.R")


